/*
 * @copyright fxsen <br/>
 * @date 2022/4/14 16:33 <br/>
 * @email <a href="mailto:fxsen@foxmail.com">
 * @author fxsen
 */
package com.fxsen.commons.core.base.common.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 基础实体类
 * @author fxsen
 * @date 2022/4/14 16:33
 * @email <a href="mailto:fxsen@foxmail.com">
 */
public class BaseEntity implements Serializable {
    private static final long serialVersionUID = 7384984524930305594L;
    /**
     *主键id
     */
    @ApiModelProperty("主键id")
    @IsKey
    @TableId(value = "id",type = IdType.ASSIGN_UUID)
    @Column(name = "id", type = MySqlTypeConstant.VARCHAR, comment = "主键id",length = 32)
    private String id;
    /**
     *创建人
     */
    @ApiModelProperty("创建人")
    @TableField(value = "create_by",fill = FieldFill.INSERT)
    @Column(name = "create_by", type = MySqlTypeConstant.VARCHAR, comment = "创建人",length = 32)
    private String createBy;
    /**
     *创建时间
     */
    @ApiModelProperty("创建时间")
    @TableField(value = "create_date",fill = FieldFill.INSERT)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//页面写入数据库时格式化
    @JSONField(format="yyyy-MM-dd HH:mm")//数据库导出页面时json格式化
    @Column(name = "create_date", type = MySqlTypeConstant.DATETIME, comment = "创建时间")
    private Date createDate;
    /**
     *更新人
     */
    @ApiModelProperty("更新人")
    @TableField(value = "update_by",fill = FieldFill.UPDATE)
    @Column(name = "update_by", type = MySqlTypeConstant.VARCHAR, comment = "更新人",length = 32)
    private String updateBy;
    /**
     *更新时间
     */
    @ApiModelProperty("更新时间")
    @TableField(value = "update_date",fill = FieldFill.UPDATE)
    @Column(name = "update_date", type = MySqlTypeConstant.DATETIME, comment = "更新时间")
    private Date updateDate;
    /**
     *状态(0:启用,1:禁用)
     */
    @ApiModelProperty(name = "状态(0:启用,1:禁用)")
    @TableField(value = "status",fill = FieldFill.INSERT)
    @Column(name = "status", type = MySqlTypeConstant.INT, comment = "状态(0:启用,1:禁用)",length = 1,defaultValue = "0")
    private int status;
    /**
     *删除标志（0代表存在 1代表删除）
     */
    @ApiModelProperty(name = "删除标志（0代表存在 1代表删除）")
    @TableLogic(value="0", delval="1")
    @TableField(value = "delete_logic",fill = FieldFill.INSERT)
    @Column(name = "delete_logic", type = MySqlTypeConstant.INT, comment = "删除标志（0代表存在 1代表删除）",length = 1)
    private int deleteLogic;
    /**
     *备注
     */
    @ApiModelProperty("备注")
    @TableField(value = "remark")
    @Column(name = "remark", type = MySqlTypeConstant.VARCHAR, comment = "备注",length = 2000)
    private String remark;
    /**
     * 排序
     */
    @ApiModelProperty(name = "排序")
    @Column(name = "order_index", type = MySqlTypeConstant.INT, comment = "排序",length = 11,defaultValue = "0")
    @TableField(value = "order_index")
    private int orderIndex;

    @ApiModelProperty("租户ID")
    //@TableField(value = "tenant_id",fill = FieldFill.INSERT)
    @Column(name = "tenant_id", type = MySqlTypeConstant.VARCHAR, comment = "租户ID",length = 32)
    private String tenantId;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getDeleteLogic() {
        return deleteLogic;
    }

    public void setDeleteLogic(int deleteLogic) {
        this.deleteLogic = deleteLogic;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getOrderIndex() {
        return orderIndex;
    }

    public void setOrderIndex(int orderIndex) {
        this.orderIndex = orderIndex;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }
}
